# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=swayr
pkgver=0.27.4
pkgrel=0
pkgdesc="A window switcher (and more) for Sway"
url="https://sr.ht/~tsdh/swayr/"
# loongarch64: libc crate fails to build
arch="all !loongarch64"
license="GPL-3.0-or-later"
makedepends="cargo cargo-auditable"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~tsdh/swayr/archive/swayr-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-swayr-$pkgver"
options="net"

# secfixes:
#   0.16.1-r0:
#     - CVE-2022-24713

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build -p swayr --release --frozen
}

check() {
	cargo test -p swayr --frozen
}

package() {
	install -D -m755 target/release/swayr -t "$pkgdir"/usr/bin/
	install -D -m755 target/release/swayrd -t "$pkgdir"/usr/bin/
}

sha512sums="
0d971b74e692e5187019bc547f8edb44f9e175b640855391b714969a8574aabf07997e8d989d54a01ed79c0e1d8a6e28dc2f409bdc88e625ef039ceb5489f359  swayr-0.27.4.tar.gz
"
